home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
bibtex99.zip
/
BIBTEX.CHP
next >
Wrap
Text File
|
1988-12-18
|
16KB
|
554 lines
* change banner
@x
@d banner=='This is BibTeX, Version 0.99c' {printed when the program starts}
@y
@d banner=='This is BibTeX, Version 0.99c (MS-DOS port by D. Vulis/J. Demel)'
@z
* include input and output
@x
@d term_out == tty
@d term_in == tty
@y
@d term_out == output
@d term_in == input
@z
* case statement changed for Prof. Pascal
@x
@d othercases == others: {default for cases not listed explicitly}
@y
@d othercases == otherwise {default for cases not listed explicitly}
@z
* If you compiler does not support this, get rid of it.
@x
@d incr(#) == #:=#+1 {increase a variable by unity}
@d decr(#) == #:=#-1 {decrease a variable by unity}
@y
@d incr(#) == inc(#)
@d decr(#) == dec(#)
@z
* The following stuff is highly ...-dependent; also, I had to re-insert
* the underlines by hand.
@x
@<Compiler directives@>=
@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
@y
@<Compiler directives@>=
@=pragma off(floating_point);@>
@=pragma data_aliasing_convention ('%a%r');@>
@=pragma routine_aliasing_convention ('%a%r');@>
@=pragma off(check_nil);@>
@=pragma on(push_regsize);@>
@=pragma off(check_range);@>
@=pragma off(check_stack);@>
@=pragma off(check_string);@>
@=pragma off(check_subscript);@>
@=pragma off(emit_line_records);@>
@=pragma off(emit_line_table);@>
@=pragma off(emit_names);@>
@=pragma on(optimize_unsigned_words);@>
@=pragma on(optimize_withs);@>
@=pragma memory_model(large);@>
@=pragma c_include('implement.pf');@>@\
package arg;
@= pragma routine_aliasing_convention(Implement.RTE_aliasing);@>
type args_type = string(256);
function args:args_type; external;
end;
with arg;
@=pragma alias(arg,Implement.RTE || 'arg'); @>
package status;
@=pragma routine_aliasing_convention(Implement.RTE_aliasing); @>
var @=Return_IO_status@>:boolean;
errno: cardinal;
procedure perror(const S: string); external;
end{package};
@=pragma alias(status,Implement.RTE || 'status'); @>
with status;
@=pragma c_include('env.pf');@>@\{get routines to access environment-variable}
with env;
@z
* We have to cut this down to reduce memory requirements.
* 3000 requires 580 kbyte free memory
* 2500 requires 530 kbyte free memory
@x
@!max_ent_strs=3000; {maximum number of |str_entry_var|s
@y
@!max_ent_strs=2500; {maximum number of |str_entry_var|s
@z
* J.Demel 1988-12-10
* position tangle to correct paragraph
@x
@* Input and output.
@y
@* Input and output.
@z
* definition of text-files changes
@x
@<Types in the outer block@>=
@!alpha_file=packed file of text_char; {files that contain textual data}
@y
@<Types in the outer block@>=
@!alpha_file=text; {files that contain textual data}
@z
* open/close of internal files
@x
@d reset_OK(#)==erstat(#)=0
@d rewrite_OK(#)==erstat(#)=0
@<Procedures and functions for file-system interacting@>=
function erstat(var f:file):integer; extern; {in the runtime library}
@#@t\2@>
function a_open_in(var f:alpha_file):boolean; {open a text file for input}
begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
end;
@#
function a_open_out(var f:alpha_file):boolean; {open a text file for output}
begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f);
end;
@
@y
@<Procedures and functions for file-system interacting@>=
@#
function a_open_in(var f:alpha_file):boolean; {open a text file for input}
begin reset(f,name_of_file);
a_open_in:=(errno=0);
if not a_open_in then perror('a_open_in ' || name_of_file);
end;
@#
function a_open_out(var f:alpha_file):boolean; {open a text file for output}
begin rewrite(f,name_of_file);
a_open_out:=(errno=0);
if not a_open_out then perror('a_open_out ' || name_of_file);
end;
@
We have to enable IO-Status-codes
@<Set initial values of key variables@>=
@=Return_IO_status@> := true;
@
@z
*
@x
@!buf_type = array[buf_pointer] of ASCII_code; {for various buffers}
@y
@!buf_type = packed array[buf_pointer] of ASCII_code; {for various buffers}
@z
* put string-pool in a seperate segment
@x
@!str_pool : packed array[pool_pointer] of ASCII_code; {the characters}
@y
@=pragma data(common,'pool'); @>
var
@!str_pool : packed array[pool_pointer] of ASCII_code; {the characters}
@=pragma data; @>
var
@z
* near line 1678
* put some large arrays into a seperate segment
@x
@!hash_next : packed array[hash_loc] of hash_pointer; {coalesced-list link}
@!hash_text : packed array[hash_loc] of str_number; {pointer to a string}
@!hash_ilk : packed array[hash_loc] of str_ilk; {the type of string}
@!ilk_info : packed array[hash_loc] of integer; {|ilk|-specific info}
@y
@=pragma data(common,'hash'); @>
var
@!hash_next : packed array[hash_loc] of hash_pointer; {coalesced-list link}
@!hash_text : packed array[hash_loc] of str_number; {pointer to a string}
@!hash_ilk : packed array[hash_loc] of str_ilk; {the type of string}
@!ilk_info : packed array[hash_loc] of integer; {|ilk|-specific info}
@=pragma data; @>
var
@z
* Lines 1862-1908 J.Demel 1988-12-11
* initialize the bst_ and bib_area from MS-DOS Environment variables
@x
@!s_bib_area : str_number; {\.{texbib:}}
@y
@!s_bib_area : str_number; {\.{texbib:}}
env_value : string(file_name_size); {temp storage for environment variable}
@z
@x
pre_define('texinputs: ',10,file_area_ilk);
s_bst_area := hash_text[pre_def_loc];
pre_define('texbib: ',7,file_area_ilk);
s_bib_area := hash_text[pre_def_loc];
@y
env_value := @=Get_env@>('TEXINPUT');
if (@=length@>(env_value)=0) then
env_value := @=Get_env@>('TEXINPUTS'); {check alternate name}
if (@=length@>(env_value)<>0) then
if env_value[@=length@>(env_value)]<>'\' then
env_value := env_value || '\'; {append \ }
pre_define(env_value,@=length@>(env_value),file_area_ilk);
s_bst_area := hash_text[pre_def_loc];
env_value := @=Get_env@>('TEXBIB');
if env_value[@=length@>(env_value)]<>'\' then
env_value := env_value || '\';
pre_define(env_value,@=length@>(env_value),file_area_ilk);
s_bib_area := hash_text[pre_def_loc];
@z
* must change parameter-definition to get the full path-name
@x
procedure pre_define (@!pds:pds_type; @!len:pds_len; @!ilk:str_ilk);
@y
procedure pre_define (@!pds:string(file_name_size);
@!len:pds_len; @!ilk:str_ilk);
@z
* Near line 2452
* Process command-line
@x
@<Procedures and functions for the reading and processing of input files@>=
procedure get_the_top_level_aux_file_name;
label aux_found,@!aux_not_found;
var @<Variables for possible command-line processing@>@/
begin
check_cmnd_line := false; {many systems will change this}
loop
begin
if (check_cmnd_line) then
@<Process a possible command line@>
else
begin
write (term_out,'Please type input file name (no extension)--');
if (eoln(term_in)) then {so the first |read| works}
read_ln (term_in);
aux_name_length := 0;
while (not eoln(term_in)) do
begin
if (aux_name_length = file_name_size) then
begin
while (not eoln(term_in)) do {discard the rest of the line}
get(term_in);
sam_you_made_the_file_name_too_long;
end;
incr(aux_name_length);
name_of_file[aux_name_length] := term_in^;
get(term_in);
end;
end;
@y
@<Procedures and functions for the reading and processing of input files@>=
procedure get_the_top_level_aux_file_name;
label aux_found,@!aux_not_found;
var @<Variables for possible command-line processing@>@/
begin
s:=args;
t:=@=length@>(s);
k:=1;
while